package com.liu.web.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author LIU
 * @version 1.0
 * @description: TODO
 * @date 2023/6/5 0:11
 */

@Slf4j
@WebServlet(urlPatterns = "/my")
public class MyFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        String requestURI = request.getRequestURI();
        log.info("MyFilter过滤器执行了,请求路径:{}",requestURI );
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
